CREATE TABLE [dbo].[TMLETR_CLIE]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_LETR_CLIE] [dbo].[TD_VC_020] NOT NULL,
[CO_TIPO_OPER] [dbo].[TD_VC_003] NOT NULL,
[CO_BANC] [dbo].[TD_VC_003] NULL,
[CO_AGEN] [dbo].[TD_VC_003] NULL,
[CO_ESTA_DOCU] [dbo].[TD_VC_003] NOT NULL,
[FE_EMIS] [dbo].[TD_DT_001] NOT NULL,
[CO_UNID_CONC] [dbo].[TD_VC_003] NOT NULL,
[FE_VENC] [dbo].[TD_DT_001] NOT NULL,
[CO_CLIE] [dbo].[TD_VC_020] NOT NULL,
[FA_TIPO_CAMB] [dbo].[TD_NU_015_006] NOT NULL CONSTRAINT [DF__TMLETR_CL__FA_TI__16D94F8E] DEFAULT ((1.000)),
[FE_PROG_COBR] [dbo].[TD_DT_001] NULL,
[IM_TOTA] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TMLETR_CL__IM_TO__17CD73C7] DEFAULT ((0)),
[IM_PAGA] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TMLETR_CL__IM_PA__18C19800] DEFAULT ((0)),
[CO_MONE] [dbo].[TD_VC_003] NOT NULL,
[IM_APLI] [dbo].[TD_NU_015_006] NOT NULL CONSTRAINT [DF__TMLETR_CL__IM_AP__19B5BC39] DEFAULT ((0)),
[ST_LETR_ADEL] [dbo].[TD_VC_001_SINO] NULL CONSTRAINT [DF__TMLETR_CL__ST_LE__1AA9E072] DEFAULT ('N'),
[NO_ENDO] [dbo].[TD_VC_050] NULL,
[NU_RENO] [dbo].[TD_VC_008] NULL,
[NU_CANJ] [dbo].[TD_VC_008] NULL,
[FE_PROT] [dbo].[TD_DT_001] NULL,
[NO_AVAL] [dbo].[TD_VC_100] NULL,
[NO_DIRE_AVAL] [dbo].[TD_VC_100] NULL,
[NU_RUCC_AVAL] [dbo].[TD_VC_020] NULL,
[NU_TELE_AVAL] [dbo].[TD_VC_020] NULL,
[TI_CLIE] [dbo].[TD_VC_003] NULL,
[DE_LUGA_GIRO] [dbo].[TD_VC_020] NULL,
[CO_VEND] [dbo].[TD_VC_020] NULL,
[TI_FACT] [dbo].[TD_VC_003] NULL,
[CO_LIQU] [dbo].[TD_VC_020] NULL,
[DE_GLOS] [dbo].[TD_VC_100] NULL,
[DE_OBSE] [dbo].[TD_VC_100] NULL,
[NU_ASTO] [dbo].[TD_VC_010] NULL,
[NU_UNIC_BANC] [dbo].[TD_VC_020] NULL,
[ST_CONT] [dbo].[TD_VC_001_INTE] NULL CONSTRAINT [DF__TMLETR_CL__ST_CO__1C9228E4] DEFAULT ('N'),
[NU_REFE] [dbo].[TD_VC_020] NULL,
[IM_SALD] [dbo].[TD_NU_016_004] NULL CONSTRAINT [DF__TMLETR_CL__IM_SA__1E7A7156] DEFAULT ((0)),
[IM_AMRT] [dbo].[TD_NU_016_004] NULL CONSTRAINT [DF__TMLETR_CL__IM_AM__1F6E958F] DEFAULT ((0)),
[IM_INTR] [dbo].[TD_NU_016_004] NULL CONSTRAINT [DF__TMLETR_CL__IM_IN__2062B9C8] DEFAULT ((0)),
[IM_VALO_CUOT] [dbo].[TD_NU_016_004] NULL CONSTRAINT [DF__TMLETR_CL__IM_VA__2156DE01] DEFAULT ((0)),
[NU_DIET] [dbo].[TD_VC_020] NULL,
[NU_PROC] [dbo].[TD_IN_001] NULL CONSTRAINT [DF__TMLETR_CL__NU_PR__224B023A] DEFAULT ((0)),
[TI_VENT] [dbo].[TD_VC_003] NULL,
[IM_PERC_LETR] [dbo].[TD_NU_016_004] NULL CONSTRAINT [DF__TMLETR_CL__IM_PE__233F2673] DEFAULT ((0)),
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TMLETR_CL__CO_US__24334AAC] DEFAULT (suser_sname()),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TMLETR_CL__FE_US__25276EE5] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TMLETR_CL__CO_US__261B931E] DEFAULT (suser_sname()),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TMLETR_CL__FE_US__270FB757] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TMLETR_CLIE] WITH NOCHECK ADD CONSTRAINT [CK__TMLETR_CL__ST_CO__1D864D1D] CHECK NOT FOR REPLICATION (([ST_CONT]='P' OR [ST_CONT]='N'))
GO
ALTER TABLE [dbo].[TMLETR_CLIE] WITH NOCHECK ADD CONSTRAINT [CK__TMLETR_CL__ST_LE__1B9E04AB] CHECK NOT FOR REPLICATION (([ST_LETR_ADEL]='N' OR [ST_LETR_ADEL]='S'))
GO
ALTER TABLE [dbo].[TMLETR_CLIE] ADD CONSTRAINT [PK__TMLETR_C__14412DCE556B7EE4] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_LETR_CLIE]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TMLETR_CLIE] ADD CONSTRAINT [FK__TMLETR_CL__CO_EM__053A8D97] FOREIGN KEY ([CO_EMPR]) REFERENCES [dbo].[TMPARA_TESO] ([CO_EMPR])
GO
ALTER TABLE [dbo].[TMLETR_CLIE] ADD CONSTRAINT [FK__TMLETR_CLIE__0446695E] FOREIGN KEY ([CO_EMPR], [CO_TIPO_OPER]) REFERENCES [dbo].[TTTIPO_OPER] ([CO_EMPR], [CO_TIPO_OPER])
GO
ALTER TABLE [dbo].[TMLETR_CLIE] ADD CONSTRAINT [FK__TMLETR_CLIE__025E20EC] FOREIGN KEY ([CO_EMPR], [TI_VENT]) REFERENCES [dbo].[TTTIPO_VETE] ([CO_EMPR], [TI_VENT])
GO
ALTER TABLE [dbo].[TMLETR_CLIE] ADD CONSTRAINT [FK__TMLETR_CL__CO_ES__03524525] FOREIGN KEY ([CO_ESTA_DOCU]) REFERENCES [dbo].[TTTIES_DOCU] ([CO_ESTA_DOCU])
GO
